package com.skyworth.${package.ModuleName}api.client.fallback;

import com.skyworth.common.feign.AbstractFeignFallback;
import com.skyworth.core.exception.FeignException;
import com.skyworth.core.pojo.dto.PageResDTO;
import com.skyworth.core.pojo.dto.ResDTO;
import com.skyworth.${package.ModuleName}api.client.${entity}Client;
import com.skyworth.${package.ModuleName}api.pojo.dto.${entity?lower_case}.req.*;
import com.skyworth.${package.ModuleName}api.pojo.dto.${entity?lower_case}.res.*;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <p>
 * ${table.comment!} 模块FALLBACK
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
@Slf4j
@Component
public class ${entity}Fallback extends AbstractFeignFallback implements FallbackFactory<${entity}Client>  {

    @Override
    public ${entity}Client create(Throwable throwable) {
        return new ${entity}Client() {

            @Override
            public ResDTO<PageResDTO<${entity}ListResDTO>> list(${entity}ListReqDTO ${entity?uncap_first}ListReqDTO) {
                return handleException(throwable);
            }

            @Override
            public ResDTO<${entity}GetResDTO> get(Long id) {
                return handleException(throwable);
            }

            @Override
            public ResDTO<Void> add(${entity}AddReqDTO ${entity?uncap_first}AddReqDTO) {
                return handleException(throwable);
            }

            @Override
            public ResDTO<Void> delete(List<Long> ids) {
                return handleException(throwable);
            }

            @Override
            public ResDTO<Void> update(${entity}UpdateReqDTO ${entity?uncap_first}UpdateReqDTO) {
                return handleException(throwable);
            }
        };
    }
}